import django_filters
from .models import OperationLog


class OperationLogFilter(django_filters.FilterSet):
    time = django_filters.CharFilter(field_name='create_datetime', lookup_expr='gte')
    start_time = django_filters.DateTimeFilter(field_name='create_datetime', lookup_expr='gte')  # 指定过滤的字段
    end_time = django_filters.DateTimeFilter(field_name='create_datetime', lookup_expr='lte')

    class Meta:
        model = OperationLog
        fields = ('create_datetime', 'request_modular', 'request_method')
